<?php
namespace app\admin\controller;
// use think\Db;
// use think\captcha\Captcha;
class Commoditylist extends Come{
    public function commoditylist(){
       
        return $this->fetch('commoditylist');
    }
   
    public function index(){
        $id_num=input('param.fenlei','','htmlspecialchars');
        // $ret=db('admin_shop')->where('num',$id_num)->select();

        $resList=db('goods_format_name')->where('type_id',$id_num)->alias('a')->join('goods_type b',' b.id=a.type_id ')
        ->field('a.*')->select();

        foreach ($resList as & $value){
            $resVal=db('goods_format_value')->where('format_id',$value['id'])->field('vals')->select();
            $format=[];
            foreach ($resVal as $val){
                $format[]=$val['vals'];
            }
            $value['vals']=$format;
        }
        // $this->success('成功','',$ret);
        return $resList;
        // return 12;
        
    }
}